/**
 * testowanie
 */
package game;

import events.TickEvent;

import java.awt.Component;

import tiles.Map;

/**
 * @author kasztan no! singleton - przerobić
 */
public class Engine implements IClockListener
{
	private KeyboardListener keyListener;
	private MapManager tilesManager;
	private Clock interval;

	private static Engine instance;

	
	// smietnik totalny, trzeba przerobic
	private Engine()
	{
	}
	
	private void registerKeys()
	{
		keyListener.getClass();
		tilesManager.getTileFromIJ(10, 10);
		//keyListener.registerKey(key, instance, callback, arguments)
	}
	
	private void attachImmages()
	{
	}

	public void init(Component keyPressDispatcher, Component drawingArea)
	{
		keyListener = new KeyboardListener(keyPressDispatcher);
		tilesManager = new MapManager(new Map(10, 10, new char[10][10]), new StandardTileKit());
		interval = new Clock();
		
		attachImmages();
		registerKeys();
		
		
		interval.start(0, 10);
		
	}
	
	static public Engine getInstance()
	{
		instance = new Engine();
		return instance;
	}
	
	public void pause()
	{
		
	}
	public void resume()
	{
		
	}
	public void start()
	{
		
	}

	public void destroy()
	{

	}
	
	public void refresh()
	{
		
	}
	public void onTick(TickEvent e)
	{
		// TODO Auto-generated method stub

	}

}
